<?php

use app\models\Isp;
use app\models\Package;
use app\models\Storage;
use app\models\Order;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\widgets\Pjax;


$this->title = '出库';
$this->params['breadcrumbs'][] = '出库操作';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php $form = ActiveForm::begin();?>
<?php echo $form->field($orderedit, 'order_id')->dropDownList(ArrayHelper::map(Order::find()->all(), 'id', 'orderno'), ['prompt' => '选择订单号']);?>
<?php Pjax::begin(['id' => 'pjax_isp']);?>
<?php echo $form->field($orderedit, 'title')->dropDownList(ArrayHelper::map(Order::find()->andFilterWhere(['id' => Yii::$app->request->get('search_order_id')])->all(), 'id', 'titles'),['readonly' => 'true']);?>

<?php echo $form->field($orderedit, 'number')->dropDownList(ArrayHelper::map(Order::find()->andFilterWhere(['id' => Yii::$app->request->get('search_order_id')])->all(), 'id', 'number'),['readonly' => 'true']);?>
<?php Pjax::end();?>

<?php echo $form->field($orderedit, 'iccid_start')->hint('开始号码和结束号码必须同时填写。');?>
<?php echo $form->field($orderedit, 'iccid_end')->hint('开始号码结束号码和ICCID列表必须至少填写一项。');?>
<?php echo $form->field($orderedit, 'iccid_list')->textarea(['style' => 'min-height:400px;']);?>
<?php echo $form->field($orderedit, 'batch_no')->textInput(['placeholder' => '不填写则会自动生成默认值。']);?>
<div class="form-group">
    <div class="col-lg-offset-1 col-lg-11">
        <button type="button" class="btn btn-default" onclick="window.history.go(-1);"><i class="ace-icon fa fa-arrow-left bigger-110"></i>返回</button>
        <button class="btn btn-primary"><i class="ace-icon fa fa-check bigger-110"></i>保存</button>
        <button type="reset" class="btn btn-warning"><i class="ace-icon fa fa-undo bigger-110"></i>重置</button>
    </div>
</div>
<?php $form->end();?>
<script>
    function pageInit() {
        $('[name="Outbound[order_id]"]').change(function () {
            var id = $(this).val();
            //alert(id);
            $.pjax.reload('#pjax_isp', {
                history: false,
                push: false,
                url: '<?php echo Url::current(['ajax' => 1]);?>&search_order_id=' + id
            });
        }).change();
    }
</script>
